package com.happy_hao.topbiz.controller.base.msgController;



import com.happy_hao.topbiz.api.MsgApi;
import com.happy_hao.topbiz.common.Result;
import com.happy_hao.topbiz.dto.msgDto.SenderRequest;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/topbiz/msg/sender")
public class SenderController {

    @Resource
    private MsgApi msgApi;

    @PutMapping("/addSender")
    public Result addSender(@Valid @RequestBody SenderRequest senderRequest){
        return msgApi.addSender(senderRequest);
    }

    @GetMapping("/getAllSenders")
    public Result getAllSenders(){
        return msgApi.getAllSenders();
    }

    @DeleteMapping("/deleteSender")
    public Result deleteSender(@RequestParam("username") String username){
        return msgApi.deleteSender(username);
    }

    @PostMapping("/updateSender")
    public Result updateSender(@Valid @RequestBody SenderRequest senderRequest){
        return msgApi.updateSender(senderRequest);
    }

}
